﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ShopLib.DA;
using ShopLib.Utils;
using ShopLib.shop.Basket;
using ShopLib.shop.basket;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["orderid"] != null)
        {
            Guid orderID;
            if (Utils.IsGuid(Request.QueryString["orderid"].ToString(), out orderID))
            {
                DABasis da = new DABasis();
                BasketGridView gv = new BasketGridView();
                gv.DataSource = da.GetBasketContent(orderID, "Price");

                foreach (DataColumn col in gv.Columns)
                {
                    //Declare the bound field and allocate memory for the bound field.
                    TemplateField bfield = new TemplateField();
                    
                    //Initalize the DataField value.
                    bfield.HeaderTemplate = new GridViewTemplate(ListItemType.Header, "tester");
                    
                    //Initialize the HeaderText field value.
                    bfield.ItemTemplate = new GridViewTemplate(ListItemType.Item, "tester");
                    
                    //Add the newly created bound field to the GridView.
                    gv.Columns.Add(bfield);
                }
                
                gv.OrderId = orderID;
                gv.SortBy = "Price";
                gv.ShowFooter = true;

                Page.Form.Controls.Add(gv);
            }
        }
    }
}
